<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>行业管理</title>
    <meta name="author" content="SuggeElson"/>
    <meta name="description"
          content="Ycode admin template - new premium responsive admin template. This template is designed to help you build the site administration without losing valuable time.Template contains all the important functions which must have one backend system.Build on great twitter boostrap framework"/>
    <meta name="keywords"
          content="admin, admin template, admin theme, responsive, responsive admin, responsive admin template, responsive theme, themeforest, 960 grid system, grid, grid theme, liquid, masonry, jquery, administration, administration template, administration theme, mobile, touch , responsive layout, boostrap, twitter boostrap"/>
    <meta name="application-name" content="Ycode admin template"/>

    <!-- Mobile Specific Metas -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

    <!-- Core stylesheets do not remove -->
    <link th:href="@{/lib/css/bootstrap/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/lib/css/bootstrap/bootstrap-responsive.min.css}" rel="stylesheet" type="text/css"/>
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
    <link th:href="@{/lib/css/supr-theme/jquery.ui.supr.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/lib/css/icons.css}" rel="stylesheet" type="text/css"/>

    <!-- Plugin stylesheets -->
    <link th:href="@{/lib/plugins/misc/qtip/jquery.qtip.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/lib/plugins/forms/uniform/uniform.default.css}" type="text/css" rel="stylesheet"/>
    <link th:href="@{/lib/plugins/tables/dataTables/jquery.dataTables.css}" type="text/css" rel="stylesheet"/>

    <!-- Main stylesheets -->
    <link th:href="@{/lib/css/main.css}" rel="stylesheet" type="text/css"/>

    <!-- Custom stylesheets ( Put your own changes here ) -->
    <link th:href="@{/lib/css/custom.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/css/main.css}" rel="stylesheet" type="text/css"/>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" th:href="@{/lib/images/favicon.ico}"/>
    <link rel="apple-touch-icon-precomposed" sizes="144x144"
          th:href="@{/lib/images/apple-touch-icon-144-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" sizes="114x114"
          th:href="@{/lib/images/apple-touch-icon-114-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" sizes="72x72"
          th:href="@{/lib/images/apple-touch-icon-72-precomposed.png}"/>
    <link rel="apple-touch-icon-precomposed" th:href="@{/lib/images/apple-touch-icon-57-precomposed.png}"/>

    <script type="text/javascript">
        //adding load class to body and hide page
        document.documentElement.className += 'loadstate';
    </script>

</head>

<body>
<div th:replace="fragments/header :: header"></div>

<div id="wrapper">

    <div th:replace="fragments/siderBar :: siderBar"></div>

    <!--Body content-->
    <div id="content" class="clearfix">
        <div class="contentwrapper"><!--Content wrapper-->

            <div class="heading">

                <h3>行业管理</h3>

            </div><!-- End .heading-->

            <div class="row-fluid">

                <div class="span12">

                    <div class="box gradient p-rel">

                        <div class="add-style">
                            <button class="btn btn-success" id="submitQuery">
                                查询
                            </button>
                            <button class="btn btn-success">
                                <a href="#addModal" class="tip"
                                   data-toggle="modal" oldtitle="Remove User"
                                   title="" data-hasqtip="true" aria-describedby="qtip-0">
                                    <span>新增</span></a>
                            </button>
                        </div>

                        <div class="title">
                            <h4>
                                <span >行业列表</span>
                            </h4>
                        </div>
                        <div class="content noPad clearfix">
                            <form class="form-horizontal" action="/industryController/list.html" id="searchForm"
                                  method="POST">
                                <input type="hidden" id="myPage" name="pageNum" th:value="${pageNum}">
                                <input type="hidden" name="pageSize" id="pageSize" th:value="${pageSize}">
                                <div id="" class="dataTables_wrapper" role="grid">
                                    <div class="queryFrom">
                                        <label style="float: left;width: 80px;text-align: right;padding-bottom: 10px;">行业名称:</label>
                                        <input type="text" class="text" id="industryName" name="industryName" th:value="${industryName}">

                                    </div>


                                </div>
                            </form>
                            <table cellpadding="0" cellspacing="0" border="0"
                                   class="responsive  display table table-bordered dataTable" width="100%"
                                   id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
                                <thead>
                                <tr role="row">
                                    <th class="sorting_asc" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-sort="ascending" aria-label="行业编号: activate to sort column descending">
                                        行业编号
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="行业名称: activate to sort column ascending">行业名称
                                    </th>

                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="创建时间: activate to sort column ascending">创建时间
                                    </th>
                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="更新时间: activate to sort column ascending">更新时间
                                    </th>

                                    <th class="sorting" role="columnheader" tabindex="0"
                                        aria-controls="DataTables_Table_0" rowspan="1" colspan="1"
                                        aria-label="操作: activate to sort column ascending">操作
                                    </th>
                                </tr>
                                </thead>

                                <tbody role="alert" aria-live="polite" aria-relevant="all" th:unless="${#lists.isEmpty(industrys)}">
                                <tr th:each="model: ${industrys}" class="gradeX odd">
                                    <input type="hidden" th:value="${model.id}"/>
                                    <td th:text="${model.id}"></td>
                                    <td th:text="${model.industryName}"></td>

                                    <td th:text="${model.createTime}"></td>
                                    <td th:text="${model.updateTime}"></td>

                                    <td th:data="${model.id}">

                                        <a href="javascript:void(0);" onclick="editModalAClick(this)" class="tip" oldtitle="Edit User" title="" data-hasqtip="true" aria-describedby="qtip-0"><span class="icon16 icomoon-icon-pencil"></span></a>
                                        <a href="javascript:void(0);" onclick="deleteModalAClick(this)" class="tip" data-toggle="modal" oldtitle="Remove User" title="" data-hasqtip="true" aria-describedby="qtip-0"><span class="icon16 icomoon-icon-remove"></span></a>

                                    </td>
                                </tr>

                                </tbody>
                                <tbody role="alert" aria-live="polite" aria-relevant="all" th:if="${#lists.isEmpty(industrys)}">
                                <tr>
                                    <td colspan="5">没有符合查询条件的记录</td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="dataTables_info" id="totel">共<span th:text="${totelPage}"></span>页</div>
                            <div class="dataTables_paginate paging_full_numbers" id="page">
                            </div>
                        </div>
                        <div id="myModal" class="modal hide fade" style="display: block;" aria-hidden="true">
                            <div class="modal-header">

                                <h3>系统提示</h3>
                            </div>
                            <div class="modal-body">
                                <input type="hidden" id="deleteId" name="deleteId"/>
                                <p>确定要删除吗？</p>
                            </div>

                            <div class="modal-footer">
                                <button class="btn btn-success" id="deleteSumbit" data-dismiss="modal">
                                    确认
                                </button>
                                <button class="btn btn-success" data-dismiss="modal">
                                    取消
                                </button>
                            </div>
                        </div>


                        <div id="addModal" class="modal hide fade" style="display: block;" aria-hidden="true">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"><span
                                        class="icon12 minia-icon-close"></span></button>
                                <h3>新增页面</h3>
                            </div>
                            <div class="modal-body">
                                <div class="content">

                                    <form class="form-horizontal"  action="/industryController/addIndustry.html" method="post" id="addIndustryForm">

                                        <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4">行业名称:</label>
                                                    <input class="span8 focused text" id="industryNameAdd" name="industryNameAdd" type="text">
                                                </div>
                                            </div>
                                        </div>


                                    </form>

                                </div>
                            </div>

                            <div class="modal-footer">
                                <button class="btn btn-success" id="addSumbit" data-dismiss="modal">
                                    确认
                                </button>
                                <button class="btn btn-success" data-dismiss="modal">
                                    取消
                                </button>
                            </div>
                        </div>


                        <div id="editModal" class="modal hide fade" style="display: block;" aria-hidden="true">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"><span
                                        class="icon12 minia-icon-close"></span></button>
                                <h3>编辑页面</h3>
                            </div>
                            <div class="modal-body">
                                <div class="content">

                                    <form class="form-horizontal"  action="/industryController/editIndustry.html" method="post" id="editIndustryForm">

                                        <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4">行业名称:</label>
                                                    <input type="hidden" id="industryIdEdit" name="industryIdEdit"/>
                                                    <input class="span8 focused text" id="industryNameEdit" name="industryNameEdit" type="text">
                                                </div>
                                            </div>
                                        </div>


                                    </form>

                                </div>
                            </div>

                            <div class="modal-footer">
                                <button class="btn btn-success" id="editSumbit" data-dismiss="modal">
                                    确认
                                </button>
                                <button class="btn btn-success" data-dismiss="modal">
                                    取消
                                </button>
                            </div>
                        </div>
                    </div>

                </div><!-- End .box -->

            </div><!-- End .span12 -->

        </div><!-- End .row-fluid -->


    </div><!-- End contentwrapper -->
</div><!-- End #content -->

</div><!-- End #wrapper -->

<!-- Le javascript
================================================== -->
<!-- Important plugins put in all pages -->
<script type="text/javascript" th:src="@{/lib/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/js/bootstrap/bootstrap.js}"></script>
<script type="text/javascript" th:src="@{/lib/js/jquery.cookie.js}"></script>
<script type="text/javascript" th:src="@{/lib/js/jquery.mousewheel.js}"></script>

<!-- Charts plugins -->
<script type="text/javascript" src="plugins/charts/sparkline/jquery.sparkline.min.js"
        th:src="@{/lib/plugins/charts/sparkline/jquery.sparkline.min.js}"></script><!-- Sparkline plugin -->

<!-- Misc plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/qtip/jquery.qtip.min.js}"></script>
<!-- Custom tooltip plugin -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/totop/jquery.ui.totop.min.js}"></script>

<!-- Search plugin -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/search/tipuesearch_set.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/misc/search/tipuesearch_data.js}"></script>
<!-- JSON for searched results -->
<script type="text/javascript" th:src="@{/lib/plugins/misc/search/tipuesearch.js}"></script>

<!-- Form plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/forms/watermark/jquery.watermark.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/forms/uniform/jquery.uniform.min.js}"></script>

<!-- Fix plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/fix/ios-fix/ios-orientationchange-fix.js}"></script>

<!-- Table plugins -->
<script type="text/javascript" th:src="@{/lib/plugins/tables/dataTables/jquery.dataTables.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/tables/responsive-tables/responsive-tables.js}"></script>
<!-- Make tables responsive -->

<!-- Important Place before main.js  -->
<script type="text/javascript" th:src="@{/lib/js/jquery-ui.min.js}"></script>
<script type="text/javascript" th:src="@{/lib/plugins/fix/touch-punch/jquery.ui.touch-punch.min.js}"></script>
<!-- Unable touch for JQueryUI -->

<!-- Init plugins -->
<script type="text/javascript" th:src="@{/lib/js/main.js}"></script><!-- Core js functions -->
<script type="text/javascript" th:src="@{/lib/js/datatable.js}"></script><!-- Init plugins only for page -->
<!-- layer -->
<script type="text/javascript" th:src="@{/lib/layer/layer.js}"></script><!-- Core js functions -->
<script type="text/javascript" th:src="@{/lib/layPage/laypage.js}"></script><!-- Init plugins only for page -->

<script type="text/javascript" src="../../static/lib/js/commonAjax.js" th:src="@{/lib/js/commonAjax.js}"></script>
<script type="text/javascript" th:src="@{/lib/dataPicker/moment.js}"></script>
<script type="text/javascript" th:src="@{/lib/dataPicker/daterangepicker.js}"></script>
<script th:replace="fragments/siderBar-router :: siderBar"></script>
<script th:replace="fragments/login-filter :: header"></script>

<script  th:inline="javascript">
    $("#submitQuery").click(function () {

        $("#searchForm").submit();

    });

    $("#addSumbit").click(function () {
        var induName = $("#industryNameAdd").val();
        if(induName.trim().length==0){
            layer.msg("行业名称不能为空！")
            //return;
        }else{

            $("#addModal").modal('hide');
            $("#addIndustryForm").submit();

//            ajaxCommonFun({
//                type: 'GET',
//                url: '/industryController/checkIndustryName.html?industryName=' + induName,
//                success: function(result) {
//                    if(result.status == 'OK'){
//                        $("#addModal").modal('hide');
//                        $("#addIndustryForm").submit();
//                    }else{
//                        layer.msg(result.message);
//                    }
//
//                }
//            });



        }

    });
    $("#editSumbit").click(function () {
        var induName = $("#industryNameEdit").val();
        if(induName.trim().length==0){
            layer.msg("行业名称不能为空！")
            //return;
        }else {

            $("#editModal").modal('hide');
            $("#editIndustryForm").submit();
//
//            ajaxCommonFun({
//                type: 'GET',
//                url: '/industryController/checkIndustryName.html?industryName=' + induName,
//                success: function(result) {
//                    if(result.status == 'OK'){
//                        $("#editModal").modal('hide');
//                        $("#editIndustryForm").submit();
//                    }else{
//                        layer.msg(result.message);
//                    }
//
//                }
//            });


        }
    });

    $("#deleteSumbit").click(function () {

        var dataparam = {
            "deleteId": $("#deleteId").val()
        };
        $.ajax({
            type: "post",
            url: "/industryController/deletIndustry.html",
            data: dataparam,
            dataType: 'html',
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            success: function(result) {
                //alert(result.code);

            }
        });
        $("#searchForm").submit();
    });

    function editModalAClick(obj) {
       var industryIdEdit = $(obj).parent().attr('data');
       var industryNameEdit = $(obj).parent().siblings().eq(2).text();
       var industryClassEdit = $(obj).parent().siblings().eq(3).text();
        $('#industryIdEdit').val(industryIdEdit);
        $('#industryNameEdit').val(industryNameEdit);
        $('#industryClassEdit').val(industryClassEdit);
        $('#editModal').modal('show');
    };
    function deleteModalAClick(obj) {

        $("#deleteId").val($(obj).parent().attr('data'));
        $('#myModal').modal('show');
    };
    laypage({
        cont: 'page',
        pages: [[${totelPage}]], //通过后台拿到的总页数
        curr: [[${currentPage}]] || 1,
        first: '首页', //若不显示，设置false即可
        last: '尾页', //若不显示，设置false即可
        prev: '上一页', //若不显示，设置false即可
        next: '下一页', //若不显示，设置false即可
        jump: function (obj, first) { //触发分页后的回调
            if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
                $("#myPage").val(obj.curr);
                $("#searchForm").submit();
            }
        }
    });

</script>

</body>
</html>
